home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
FDF101.ARJ
/
ELIB.ZOO
/
delete.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-30
|
495b
|
25 lines
#include <sys/stat.h>
/*
* delete_file
*
* given the name of a file, attempt to delete it and return zero on success,
* non-zero if not. 'force' parameter, if non-zero, will try to change the
* mode of a file from read-only to delete it.
*/
int delete_file(char *file, char force)
{
if (force) {
struct stat statbuf;
if ((!stat(file, &statbuf)) && (!(statbuf.st_mode & S_IWRITE)))
chmod(file, statbuf.st_mode | S_IWRITE);
}
return unlink(file);
}